//---------------------------------------------------------------------------

#ifndef StockReportH
#define StockReportH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Db.hpp>
#include <DBTables.hpp>
#include <ExtCtrls.hpp>
#include <QuickRpt.hpp>
#include <Qrctrls.hpp>
#include <QRCtrls.hpp>

//---------------------------------------------------------------------------
class TStockReport
{
   public:
      TStockReport( TDatabase * database);
      ~TStockReport();

      TQuery * GetQuery();

      void Produce( __int64 firmID, AnsiString model);
      void Close();

   private:
      TQuery * qryModels;

      void BuildQuery();
};

//---------------------------------------------------------------------------

typedef struct ttotal
{
   int remain;
   double cost;
   AnsiString firmName;
} TTotal;

class TfrmStockReport : public TForm
{
__published:	// IDE-managed Components
        TQuickRep *qrStock;
        TQRBand *bndDetails;
        TQRDBText *txtModel;
        TQRDBText *txtPrice;
        TQRDBText *txtDiff;
        TQRDBText *txtCost;
        TQRBand *qrPageHeader;
        TQRLabel *lblModel;
        TQRLabel *lblPrice;
        TQRLabel *lblRemain;
        TQRLabel *lblCost;
        TQRBand *bndSummary;
        TQRLabel *lblTotalRemain;
        TQRLabel *lblRemainCost;
        TQRLabel *lblTotal;
        TQRGroup *bndGroup;
        TQRDBText *txtFirm;
        TQRLabel *lblName;
        void __fastcall FormDestroy(TObject *Sender);
        void __fastcall txtDiffPrint(TObject *sender, AnsiString &Value);
        void __fastcall bndSummaryBeforePrint(TQRCustomBand *Sender,
          bool &PrintBand);
        void __fastcall txtCostPrint(TObject *sender, AnsiString &Value);
private:	// User declarations
        TStockReport * stockReport;
        TTotal total;


public:		// User declarations
        __fastcall TfrmStockReport(TComponent* Owner, TDatabase * dbMain);
        void Preview( __int64 firmID, AnsiString model);
};
//---------------------------------------------------------------------------

#endif
